import QtQuick 1.1
import com.nokia.meego 1.0

Dialog {
    id: aboutDialog

    property Style platformStyle: QueryDialogStyle {}

    property string title: "Dućanko"
    property string message:  qsTr("version")+" 2.0.6\nhttp://ducanko.com.hr\nducanko@gmail.com\n\n"+
                              qsTr("Authors:")+ "\nAntonio Krnjak\nPetar Palašek\n\n"+
                              qsTr("Design:")+"\nEna Jurov\n\n"+
                              qsTr("Translations:")+
                              "\nitaliano: Nina Smolčić"+
                              "\nsrpski: Dušica Lukić"+
                              "\nDeutsch: Peter Reinprecht"+
                              "\nTürkçe: Yusuf Alper Bilgin"+
                              "\nfrançais: Mirjana Kovačević"+
                              "\nбеларуская мова: Dzmitry Suslau"+
                              "\nportuguês: Caroline Rodrigues"+
                              "\nnorsk: Lejla Begluk" +
                              "\nрусский: Igor Yanchenko" +
                              "\nукраїнська мова: Igor Yanchenko" +
                              "\nslovenčina: Dušan Dodek" +
                              "\npolski: Szymon Pieprzyk" +
                              "\nespañol: Nicolás Budzko" +
                              "\nالعربية: Chrystelle Neaime"+
                              "\nsuomi: Juhi Somani"+
                              "\n\n"+
                              qsTr("Special thanks to:")+"\nAna "+qsTr("and")+" Katica :)"


    property string acceptButtonText
    property string rejectButtonText: qsTr("Back")
    property string languageAgainText

    signal accepted()

    content:

        Column{

        anchors.horizontalCenter: parent.horizontalCenter
        width: parent.width
        spacing: aboutDialog.platformStyle.buttonsColumnSpacing

        Row{
            width: parent.width

            Text{
                id: titleText

                text: title
                width: parent.width

                font.family: aboutDialog.platformStyle.titleFontFamily
                font.pixelSize: aboutDialog.platformStyle.titleFontPixelSize
                font.bold:  aboutDialog.platformStyle.titleFontBold
                font.capitalization: aboutDialog.platformStyle.titleFontCapitalization
                color: aboutDialog.platformStyle.titleTextColor

                horizontalAlignment: Text.AlignHCenter
                verticalAlignment:   Text.AlignVCenter

            }
        }

        Item{
            id: scrollableText
            width: parent.width
            height: 500

            Flickable {
                id: flickArea
                anchors.fill: parent
                contentWidth: parent.width; contentHeight: messageText.height
                flickableDirection: Flickable.VerticalFlick
                clip: true

                TextEdit{
                    id: messageText

                    horizontalAlignment: Text.AlignHCenter

                    font.family: aboutDialog.platformStyle.messageFontFamily
                    font.pixelSize: aboutDialog.platformStyle.messageFontPixelSize
                    color: aboutDialog.platformStyle.messageTextColor

                    wrapMode: TextEdit.Wrap
                    width:parent.width
                    //height: parent.height
                    readOnly:true

                    text:  message
                }
            }
        }
    }

    buttons:
        //The following code is taken from QueryDialog.qml

        Item {
        id: buttonColFiller
        width: parent.width
        height: childrenRect.height

        anchors.top: parent.top

        Item {id: dummy; anchors.fill:  parent}

        Column {
            id: buttonCol
            anchors.top: parent.top
            anchors.topMargin: aboutDialog.platformStyle.buttonTopMargin
            spacing: aboutDialog.platformStyle.buttonsColumnSpacing

            height: (acceptButton.text  == "" ? 0 : acceptButton.height)
                    + (rejectButton.text == "" ? 0 : rejectButton.height)
                    + anchors.buttonTopMargin  + spacing

            anchors.horizontalCenter: parent.horizontalCenter

            Button {
                id: acceptButton
                text: acceptButtonText
                onClicked: {
                    accepted()
                }
                visible: text != ""
                __dialogButton: true
                platformStyle: ButtonStyle {inverted: true}
            }
            Button {
                id: rejectButton
                text: rejectButtonText
                onClicked: {
                    aboutDialog.destroy()
                }
                visible: text != ""
                __dialogButton: true
                platformStyle: ButtonStyle {inverted: true}
            }
            Button {
                id: languageAgainButton
                text: languageAgainText
                onClicked: {
                    acceptButtonText=""
                    rejectButtonText=""
                    languageAgainText=""
                    message="Push the button below (again) to select the language of your choice!"
                    chooseLanguage.text="Push me!"
                }
                visible: text != ""
                __dialogButton: true
                platformStyle: ButtonStyle {inverted: true}
            }
        }
    }

    states: [
        State {
            name: "inLandscape"
            when: !appWindow.inPortrait
            PropertyChanges {
                target: scrollableText
                height: 250
            }
        },
        State {
            name: "inPortrait"
            when: appWindow.inPortrait
            PropertyChanges {
                target: scrollableText
                height: 500
            }
        }
    ]
}
